<?php
namespace Home\Controller;
use Utuo\ForegroundController;
class MicroVoteCommentController extends ForegroundController
{
	public function _init(){
	    layout ( false );
		C('TOKEN_ON',false);
	}
	public function indexAction(){
		$condation=array(
			'micro_vote_id'=>I('micro_vote_id','0','intval'),
			'cid'=>I('cid',0,'intval')	,
			'status'=>1,
			'is_deleted'=>0		
		);
	    $microVoteComment=M('MicroVoteComment')->order('id desc')->where($condation)->select();
		$microVoteComment!==false and $this->ajaxReturn($microVoteComment);
		
		
	}
	public function saveAction(){
		$m=D('MicroVoteComment');
		if($m->create())
		{
		$m->create_time=time();
		$m->add()?$this->ajaxSuccess('评论成功'):$this->ajaxError('评论失败');	
		}else {
			$this->ajaxError($m->getError());
		}
	}
	
}